const path = require("path");
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
function resolve(dir) {
  return path.join(__dirname, dir);
}
const config = {
  plugins: [vue()],
  server: {
    hmr: true,
  },
  resolve: {
    alias: {
      "@": resolve("src"),
    },
  },
};
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
  console.log(command);
  if (command == "serve") {
    config.server.port = 3001;
    return {
      ...config,
    };
  } else {
    config.server.port = 3002;
    return {
      ...config,
    };
  }
});
